import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'layout',
    redirect: '/home',
    component: () => import(/* webpackChunkName: "layout" */ '@/views/layout/index.vue'),
    children: [{
      path: '/home',
      name: 'home',
      component: () => import(/* webpackChunkName: "home" */ '@/views/home/index.vue'),
    },{
      path: '/select/car',
      name: 'selectCar',
      component: () => import(/* webpackChunkName: "selectCar" */ '@/views/selectCar/index.vue'),
    }]
  },
  {
    path: '/select/car/:id',
    name: 'post',
    component: () => import('@/views/post/index.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
